import moment from 'moment'
export default {
    //工具方法

    formateDate(time){
        if(!time)return '';
        return moment(time).format('YYYY-MM-DD HH:mm:ss');
    },
    
    //分页
    pagination(data,callback){
        return {
            onChange:(current)=>{
                callback(current)
            },
            current:data.page,
            pageSize:20,
            total: data.totalRecord,
            showTotal:()=>{
                return `共${data.totalRecord}条`
            },
            showQuickJumper:true
        }
    },
    
    cmdTypeDisplay(cmdType){
        switch (cmdType) {
            case "9011":
                return "主站IP设置";
            case "9012":
                return "主站IP查询";
            case "9013":
                return "上报周期设置";
            case "9014":
                return "上报周期查询";
            case "9015":
                return "自醒上报时间设置";
            case "9016":
                return "自醒上报时间查询";
            case "9021":
                return "冻结日设置";
            case "9022":
                return "冻结日查询";
            case "9031":
                return "近60日日用量查询";
            case "9032":
                return "近120月月用量查询";
            case "9033":
                return "自醒上报";
            case "9034":
                return "手动按键上报";
            case "9035":
                return "累计用量查询";
            case "9041":
                return "远程开阀";
            case "9042":
                return "远程关阀";
            case "9051":
                return "故障上报";
            case "9052":
                return "故障清除指令";
            case "9091":
                return "上电上传";
            case "9092":
                return "掉电上传";
            case "9093":
                return "表具编号设置";
            case "9094":
                return "报警参数设置";
            case "9095":
                return "燃气表底数设置";
            case "9096":
                return "RTC校时设置";
            default: 
                console.log('00')
        }
    }
}